]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Magnifier: fix a warning when calling setActive() with the same value
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 13 Feb 2014 14:11:07 +0000 (15:11 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 13 Feb 2014 18:31:00 +0000 (19:31 +0100)
We must not call enable/disable_unredirect if we didn't change the
active value, otherwise mutter gets confused and emits warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=724293

js/ui/magnifier.js

index 96c12b22e4ad7a8d9e0a7774cbf8373e8b5b0680..81e3553a4b3ad2c349e835188f07bde7861df5c4 100644 (file)
@@ -105,17 +105,20 @@ const Magnifier = new Lang.Class({
      * @activate:   Boolean to activate or de-activate the magnifier.
      */
     setActive: function(activate) {
+        let isActive = this.isActive();
+
         this._zoomRegions.forEach (function(zoomRegion, index, array) {
             zoomRegion.setActive(activate);
         });
 
-        if (activate) {
-            Meta.disable_unredirect_for_screen(global.screen);
-            this.startTrackingMouse();
-        }
-        else {
-            Meta.enable_unredirect_for_screen(global.screen);
-            this.stopTrackingMouse();
+        if (isActive != activate) {
+            if (activate) {
+                Meta.disable_unredirect_for_screen(global.screen);
+                this.startTrackingMouse();
+            } else {
+                Meta.enable_unredirect_for_screen(global.screen);
+                this.stopTrackingMouse();
+            }
         }
 
         // Make sure system mouse pointer is shown when all zoom regions are